package br.mg.bhe.ftpobre.fs;

import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;

import br.mg.bhe.ftpobre.util.LogUtil;

/**
 * 
 * @author Aureliano
 */
public class OpenLinuxFile implements IOpenFile {

	@Override
	public void open(File file) {
		try {
			Desktop.getDesktop().open(file);
		} catch (IOException ex) {
			LogUtil.getLogger(OpenLinuxFile.class).log(Level.WARNING, ex.getMessage());
			
			try {
				Runtime.getRuntime().exec("gedit " + file.getAbsolutePath());
			} catch (Exception ex2) {
				throw new RuntimeException(ex2);
			}
		}
	}
}